package com.quece.test;

import java.util.concurrent.BlockingQueue;

class Consumer implements Runnable {
    private String name;
    private BlockingQueue s = null;

    public Consumer(String name, BlockingQueue s) {
        this.name = name;
        this.s = s;
    }

    public void run() {
        try {
            while (true) {
                String product = (String) s.take();
                System.out.println(name + "消费(" + product.toString() + ").");
                System.out.println("===============");
                Thread.sleep(300);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

}